﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TreeSharp;

namespace FelMaster.Classes.Warlock
{
    class Demonology : TalentBase
    {
        public override string Name
        {
            get { return "Simple Demonology with Felguard"; }
        }

        public override string KeySpell
        {
            get { return "Summon Felguard"; }
        }

        public override Composite SingleRotation
        {
            get
            {
                return new PrioritySelector(
                    SC.CastSpell("Life Tap", a => Me.ManaPercent < 30, "Life tap - mana < 30%"),

                    SC.CastDebuff("Curse of the Elements", a => Me.CurrentTarget.HealthPercent > 70, "CoE"),
                    SC.CastUniqueSpell("Summon Felguard", a => (Pet == null || Pet.Dead) && (SC.PlayerHasBuff("Demonic Rebirth") || SC.PlayerHasBuff("Soulburn")), "Summon new Felguard"),
                    SC.CastSpell("Metamorphosis", a => true, "Morph!"),
                    SC.CastSpell("Demon Soul", a => !Me.IsMoving, "Demon Soul while not moving"),
                    SC.CastDebuff("Bane of Doom", a => Me.CurrentTarget.CurrentHealth > 100000 || Me.CurrentTarget.MaxHealth == 1, "Bane of Doom"),
                    SC.CastDebuff("Immolate", a => true, "Immolate"),
                    SC.CastDebuff("Corruption", a => true, "Corruption"),
                    SC.CastSpell("Felstorm(Special Ability)", a => true, "Felstorm"),
                    SC.CastSpell("Hand of Gul'dan", a => true, "Hand of gul'dan"),
                    SC.CastSpell("Incinerate", a => SC.PlayerHasBuff("Molten Core"), "Incinerate: molten core proc"),
                    SC.CastSpell("Soulburn", a => true, "Soulburn"),
                    SC.CastSpell("Soul Fire", a => SC.PlayerHasBuff("Soulburn") || SC.PlayerHasBuff("Decimation"), "SF on soulburn/decimation"),
                    SC.CastSpell("Summon Doomguard", a => !SC.PlayerHasBuff("Metamorphosis"), "Doomguard"),
                    SC.CastSpell("Shadow Bolt", a => true, "Shadow bolt"),
                    SC.CastSpell("Life Tap", a => Me.IsMoving && Me.HealthPercent > Me.ManaPercent && Me.ManaPercent < 80, "Life tap while moving"),
                    SC.CastSpell("Fel Flame", a => Me.IsMoving, "Fel flame while moving")
                );
            }
        }

        public override Composite Buffs
        {
            get
            {
                return new PrioritySelector(
                    //buffs
                    SC.CastBuff("Fel Armor", a => true, "Fel Armor"),
                    SC.CastUniqueSpell("Summon Felguard", a => !Me.Combat && !Me.Mounted && Pet == null || Pet.Dead, "Summon new Felguard"),
                    SC.CastBuff("Soul Link", a => Pet != null && Pet.IsAlive, "Soul Link")
                );
            }
        }

        public override Composite PVPRotation
        {
            get { throw new NotImplementedException(); }
        }

        public override Composite PVERotation
        {
            get
            {
                return SingleRotation;
            }
        }
    }
}
